package yqt.com.cnki.controller;

import cnki.tpi.util.StrUtil;
import haha.life.common.CutPageBean;
import jzqb.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yqt.com.cnki.bo.KYDABo;
import yqt.com.cnki.po.KYDAPo;
import yqt.com.cnki.service.IKYDAService;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * Description: 科研档案
 *
 * @author BaiGe
 * @date: 2021/12/21 14:25
 * @Version 1.0
 */
@RestController
@RequestMapping("/kyda")
public class KYDAController {
    @Autowired
    private IKYDAService kydaService;

    @PostMapping("/complexSearch_kyda")
    public Result complexSearch_kyda(@RequestBody KYDABo kydaBo) {
        CutPageBean<KYDAPo> cutPageBean = kydaService.complexSearch_kyda(kydaBo);
        return Result.succ(cutPageBean);
    }

    @GetMapping("/getIpAddress")
    public Result getIpAddress(HttpServletRequest request) {
        String ipAddress="";
        try {
             ipAddress = StrUtil.getIpAddress(request);
            System.out.println(ipAddress);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return Result.succ(ipAddress);
    }
}
